﻿<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<head>
<title>新增优惠劵</title>
<meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
<link href="<%=request.getContextPath()%>/style/adminStyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jquery.min.js"></script>
</head>
<body>
	<div class="wrap">
		<div class="page-title">
			<span class="modular fl"><i></i><em>新增节日优惠劵</em></span>

		</div>
	<form enctype="multipart/form-data">
		<table class="list-style">
			<tr>
				<td style="text-align: right; width:27%;">优惠节日：</td>
				<td><input type="text" class="textBox" id="using" /></td>
			</tr>
			<tr>
				<td style="text-align: right; width:27%;">优惠金额：</td>
				<td><input type="text" class="textBox" id="reduction" /></td>
			</tr>

			<tr>
				<td style="text-align:right; width:27%;">备注：</td>
				<td><textarea class="textarea" id="remarks"></textarea></td>
			</tr>

			<tr>
				<td style="text-align: right;"></td>
				<td><input type="button" value="生成" class="tdBtn"
					onclick="return selec()"/></td>
			</tr>
		</table>
		</form>
	</div>
<script type="text/javascript">

function selec(){
	var usingplatform=$("#using").val();
	var reduction=$("#reduction").val();
	var remarks=$("#remarks").val();
	if(reduction==""||usingplatform==""||reduction==null||usingplatform==null){		
		 alert("信息添加不完整");
		return false;
	}else{		
		var msg = "您确定要生成节日活动优惠劵吗？\n\n请确认！";
		if (confirm(msg)==true){
			$.ajax({
				"url":"${pageContext.request.contextPath}/Administrators/coupon_add_addfest.do",
				"data":'remarks='+remarks+'&reduction='+reduction+'&usingplatform='+usingplatform,
				"type":"POST",
				"dataType":"json",
				"success":function(str){
					if(str.state==1){
						 alert("生成成功");
						window.location="${pageContext.request.contextPath}/Administrators/coupon_festival.do";
					}else if(str.state==400){
						 alert("已经有节日活动啦");
					}else{
						alert("生成失败");
					}
				}});		
		
		}
	}
	
	}
</script>
</body>
</html>